import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by Salted fish
 * Description:
 * User: 24539
 * Date：2021-07-30
 * Time: 12:52
 */
public class Test4 {
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5,6,7,8,9,10};
        System.out.println(Arrays.toString(Even(arr)));
    }
    public static int[] Even(int[] a) {
        int left=0;
        int right=a.length-1;
        while(left<right){
            while ((left<right) && a[left] % 2 != 0)
            {
                left++;
            }
            while ((left<right) && a[right] % 2 == 0)
            {
                right--;
            }
            if (left < right)
            {
                int tmp = a[left];
                a[left] = a[right];
                a[right] = tmp;
            }
        }
        return a;
    }

}
    /*public static void main(String[] args) {
        int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9};
        System.out.println(find(a));
    }

    public static int[] find(int[] a) {
        int let = 0;
        int rig = a.length - 1;
        while (let < rig) {
            while ((let < rig) && a[let] %2 != 0) {
                let++;
            }
            while ((let < rig) && a[rig] % 2 ==0) {
                rig--;
            }
            if (let < rig) {
                int z = a[let];
                a[let] = a[rig];
                a[rig] = z;
            }
        }
        return a;
    }
}*/